using Domain;
using ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WriteAPI.Command.生产计划;

namespace WriteAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductionPlanController : ControllerBase
    {
        private readonly IMediator _mediator;

        public ProductionPlanController(IMediator mediator)
        {
            _mediator = mediator;
        }
        [HttpPost]
        public async Task<APIResult<int>> AddProductionPlan(AddProductionPlanCommand request, CancellationToken cancellationToken)
        { 
        
        return await _mediator.Send(request, cancellationToken);
        }


        [HttpGet]
        public async Task<APIPaging<Lwp_ProductionPlan>> GetProductionPlan([FromQuery]GetProductionPlanCommand request, CancellationToken cancellationToken)
        {

            return await _mediator.Send(request, cancellationToken);

        }
        [HttpPost]
        public async Task<APIResult<object>> DelProductionPlan(DelProductionPlanCommand request, CancellationToken cancellationToken)
        {
        return await _mediator.Send(request, cancellationToken);
        }
        
        }

    }

